home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / clipper / nannws35.arc / UDREX.PRG < prev   
Text File  |  1989-03-01  |  2KB  |  26 lines

  1. * Program: UDRex.prg
  2. * Author:  Arthur Stalk
  3. * Version: McMax 2.0
  4. * Note(s): Example of the correct use of a user-defined READ.
  5. *          Also includes examples of pop-up menus and buttons.
  6. *
  7. * Copyright (c) 1989 Nantucket Corporation.
  8.  
  9. SET PROCEDURE SELFSET TALK OFFCLEARdummy = ENABLEITEM("Quit",.T.)  && Enables QUIT from file menu.
  10. USE employee INDEX employee  && This .DBF contains
  11.                              && fields Name,Occuptn,Yearly.
  12. readOK = SETREAD("MYREAD")   && Assigns MYREAD as read procedure.
  13. IF readOK  GO TOP  @2, 10  SAY "Name                " GET name  @4, 10  SAY "Occupation        " GET occuptn  @6, 10  SAY "Yearly Salary    " GET yearly  @8, 10  SAY "Weekly Salary   "  @8, 26 SAY yearly/ 52 PICTURE "###,###.##"  @12,10 BUTTON "Previous",1 && The following three statements
  14.   @12,25 BUTTON "Next",2     && place three buttons on the screen
  15.   @12,40 BUTTON "Done",3     && with Previous, Next, and Done as
  16.                              && their titles.
  17.   READENDIFdummy = ENABLEITEM("Quit",.F.)  && Disable "Quit" option.
  18. CLEAR
  19. RETURN
  20.  
  21. PROCEDURE MyReadPRIVATE cGet, nGet, mode, theMenu, theButtoncGet = NEXTGET()DO WHILE cGet <> 0  mode = READGET(cGet)  nGet  = NEXTGET()    IF mode = 1                && READGET() exited normally.
  22.     IF cGET = 3      @8,26 SAY yearly/52 PICTURE "###,###.##"    ENDIF  ENDIF  IF mode = 4    theMenu = MENUHIT()    DO CASE      CASE theMenu = ASC("Quit")        dummy = READGET(0)   && Clears the READGET() border.
  23.         nGet = 0    ENDCASE  ENDIF  IF mode = 5    theButton = BUTTONHIT()    DO CASE      CASE theButton = 1        SKIP -1        IF BOF()          ?? CHR(7)          GO TOP        ENDIF        @8,26 SAY yearly/52 PICTURE "###,###.##"       CASE theButton = 2    && Next Button.
  24.           SKIP          IF EOF()             ?? CHR(7)             GO BOTTOM           ENDIF        @8,26 SAY yearly/52 PICTURE "###,###.##"                CASE theButton = 3   && Finished !!!
  25.           dummy = READGET(0) && Clears READ border.
  26.           nGet = 0        ENDCASE    ENDIF    cGet = nGetENDDORETURN